local skill = fk.CreateSkill {
  name = "ling__hide_capacities_skill",
}

skill:addEffect("cardskill", {
  prompt = "#ling__hide_capacities_skill",
  mod_target_filter = Util.TrueFunc,
  can_use = Util.CanUseToSelf,
  on_effect = function(self, room, effect)
    local player = effect.to
    room:askToDiscard(player, {
      min_num = 2,
      max_num = 2,
      include_equip = true,
      skill_name = skill.name,
      cancelable = false,
    })
    if player.dead then return end
    player:drawCards(2, skill.name)
    if player.dead then return end
    if table.every(room.alive_players, function (p)
      return p.hp >= player.hp
    end) then
      room:recover{
        who = player,
        num = 1,
        recoverBy = player,
        skillName = skill.name,
        card = effect.card,
      }
    end
  end,
})

return skill
